package com.csun.cmny.provider.service.impl;

import com.csun.cmny.provider.dao.DmcMoheMapper;
import com.csun.cmny.provider.model.domain.DmcDeviceAlert;
import com.csun.cmny.provider.model.dto.mohe.AlarmReceiveDto;
import com.csun.cmny.provider.model.dto.mohe.MoheDto;
import com.csun.cmny.provider.model.dto.mohe.MoheVO;
import com.csun.cmny.provider.model.enums.device.DmcDeviceAlertTypeEnum;
import com.csun.cmny.provider.service.DmcDeviceAlertService;
import com.csun.cmny.provider.service.DmcMoheService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Slf4j
@Service
public class DmcMoheServiceImpl implements DmcMoheService {

    @Resource
    DmcDeviceAlertService dmcDeviceAlertService;

    @Resource
    DmcMoheMapper dmcMoheMapper;

    @Override
    public List<MoheVO> list(MoheDto moheDto) {
        List<MoheVO> list = dmcMoheMapper.list(moheDto);
        return list;
    }


    @Override
    public int convertAlertType(String type) {
        if (type.equals("1")) {
            return DmcDeviceAlertTypeEnum.EMERGENCY_CALLER.getKey();
        } else if (type.equals("2")) {
            return DmcDeviceAlertTypeEnum.INFRARED_DETECTOR.getKey();
        } else if (type.equals("3")) {
            return DmcDeviceAlertTypeEnum.DOOR_SENSOR.getKey();
        } else if (type.equals("4")) {
            return DmcDeviceAlertTypeEnum.GAS_ALARM.getKey();
        } else if (type.equals("5")) {
            return DmcDeviceAlertTypeEnum.SMOKE_ALARM.getKey();
        } else if (type.equals("6")) {
            return DmcDeviceAlertTypeEnum.OVERFLOW_ALARM.getKey();
        } else {
            log.info("不知名的type:{}", type);
            return 99;
        }

    }
}
